//
//  GenderViewController.m
//  Light
//
//  Created by 骁唐 on 15/9/7.
//  Copyright (c) 2015年 骁唐. All rights reserved.
//

#import "GenderViewController.h"
#import "UserConfig.h"

@interface GenderViewController ()
@property (copy,nonatomic) NSString *gender;
@property (weak, nonatomic) IBOutlet UIImageView *backGround;

@end

@implementation GenderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.gender = @"女";
    [_womanButton setHighlighted:NO];
    [_manButton setHighlighted:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)backClick {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)manBtnAction:(id)sender {
    [_womanButton setHighlighted:YES];
    [_manButton setHighlighted:NO];
    self.gender = @"男";
}

- (IBAction)womanBtnAction:(id)sender {
    [_womanButton setHighlighted:NO];
    [_manButton setHighlighted:YES];
    self.gender = @"女";
}
- (IBAction)nextClick {
    UserConfig *userConfig = [UserConfig sharingUserConfig];
    [userConfig setCurrentuserGender:self.gender];
    [self performSegueWithIdentifier:@"genderToBirthday" sender:nil];
    
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    //强制竖屏
    [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:
                                        UIInterfaceOrientationPortrait]  forKey:@"orientation"];
    //SXW__标记，设置背景
    long long int currentTimeInt = [TJJDefines getTimeIntSince1970Current];
    if (currentTimeInt>=16200&& currentTimeInt <=34200) {
        self.backGround.image = [UIImage imageNamed:@"backgroundOne"];
    }else if (currentTimeInt>34200 && currentTimeInt<=55800)
    {
        self.backGround.image = [UIImage imageNamed:@"backgroundTwo"];
    }else if (currentTimeInt>55800 && currentTimeInt<=70200)
    {
        self.backGround.image = [UIImage imageNamed:@"backgroundThree"];
    }else if(currentTimeInt >70200 || currentTimeInt<16200)
    {
        self.backGround.image = [UIImage imageNamed:@"background_night"];
    }
}
@end
